import React, { Component } from 'react'
import { actions, getArr,getSeckill,getHomegoods } from "../../store/modules/home"
import { bindActionCreators } from "redux";
import { connect } from "react-redux"

//引入图片
import logo2 from "../../assets/img/logo2.png"
import juan4 from "../../assets/img/home_youhuijuan4.png"
import home_menu from "../../assets/img/home_menu.png"
import home_qianggou from "../../assets/img/home_qianggou.png"
import home_menu1 from "../../assets/img/home_menu1.png"

//引入css
import "./Home.css"
/* 引入模块 */
import Xrzx from "./components/xrzx/Xrzx.jsx"
import Seckill from "./components/Seckill/Seckill.jsx"
import Xsms from "./components/xsms/xsms.jsx"

class Home extends Component {
    componentDidMount() {
        let {home: { reqNew,reqSeckill, }} = this.props;
        reqNew();
        reqSeckill();
    }
    render() {
        let {newList,seckill,homegoods} = this.props
        return (
            <div id="home">
                <div className="sousuo">
                    <img src={logo2} alt="" />
                    <input type="text" className="iconfont" placeholder=" &#xe610; 按内容搜索" />
                    <i>搜索</i>
                    <span className="iconfont ii">&#xe613;</span>
                </div>
                {/* 新人专享 */}
                <Xrzx newList={newList}></Xrzx>
                {/* 限时秒杀 */}
                <div className="home_menu">
                    <img src={home_menu} alt="" />
                </div>
                {/* 超级秒杀 */}
                <Seckill list={seckill}></Seckill>
                {/* 限时秒杀 */}
                <Xsms newList={newList}></Xsms>
                {/* 双11 */}
                <img src={home_menu1} alt=""/>
                {/* 综合推荐 */}
                <div className="tuijian">
                    <h3>综合推荐</h3>
                    <span>销量</span>
                    <span>价格</span>
                    <span>好评度</span>
                    <span>店铺</span>
                    <em>分类</em>
                </div>
                

            </div>
        )
    }
}

let mapStatesToProps = state => ({
    newList: getArr(state),
    seckill:getSeckill(state),   
})
let mapDispatchToProps = dispatch => ({
    home: bindActionCreators(actions, dispatch)
})
export default connect(mapStatesToProps, mapDispatchToProps)(Home);